using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public abstract class AssemblerPropertyShow : MonoBehaviour
{
    public abstract void Init(Player assmebler);
}

public class FiveDimensionsShow : AssemblerPropertyShow
{
    public Transform magicTopPos;
    public Transform fightTopPos;
    public Transform flyTopPos;
    public Transform swimTopPos;
    public Transform climbTopPos;
    public Transform magicBottomPos;
    public Transform fightBottomPos;
    public Transform flyBottomPos;
    public Transform swimBottomPos;
    public Transform climbBottomPos;

    //public ProtoShape2D protoShape2D;

    private Player m_Player;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    public override void Init(Player assmebler)
    {
        m_Player = assmebler;
        
        UserInfo fiveDimensions = assmebler.data;
        
        GameDebug.LogShowy($"five dimensions speed:{fiveDimensions.birthYear} climbing:{fiveDimensions.income} fighting:{fiveDimensions.height}  flying:{fiveDimensions.weight} swim:{fiveDimensions.eduation}");

        Vector3 magicPos = Vector3.Lerp(this.magicBottomPos.localPosition, this.magicTopPos.localPosition, fiveDimensions.birthYear);
        Vector3 fightPos = Vector3.Lerp(this.fightBottomPos.localPosition, this.fightTopPos.localPosition, fiveDimensions.height);
        Vector3 flyPos = Vector3.Lerp(this.flyBottomPos.localPosition, this.flyTopPos.localPosition, fiveDimensions.weight);
        Vector3 swimPos = Vector3.Lerp(this.swimBottomPos.localPosition, this.swimTopPos.localPosition, fiveDimensions.eduation);
        Vector3 climbPos = Vector3.Lerp(this.climbBottomPos.localPosition, this.climbTopPos.localPosition, fiveDimensions.income);
        
        //GameDebug.LogError($"points:" + protoShape2D.points.Count);
        //protoShape2D.points[0].position = magicPos;
        //protoShape2D.points[1].position = fightPos;
        //protoShape2D.points[2].position = flyPos;
        //protoShape2D.points[3].position = swimPos;
        //protoShape2D.points[4].position = climbPos;

        //protoShape2D.UpdateMesh();
    }

    public void Refresh()
    {
        Init(m_Player);
    }

    // Update is called once per frame
    void Update()
    {
/*#if UNITY_EDITOR
        protoShape2D.points[0].position = magicTopPos.localPosition;
        protoShape2D.points[1].position = fightTopPos.localPosition;
        protoShape2D.points[2].position = flyTopPos.localPosition;
        protoShape2D.points[3].position = climbTopPos.localPosition;
        protoShape2D.points[4].position = swimTopPos.localPosition;

        protoShape2D.UpdateMesh();
#endif*/
    }
}
